package managedBean;

import Merlion.util.state.ClientState;
import Merlion.util.state.CreditProfileState;
import java.io.Serializable;
import java.util.List;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.PhaseEvent;

@ManagedBean(name = "CreditDisplayManagedBean")
@ViewScoped
public class CreditDisplayManagedBean implements Serializable {

    private Long creditProfileId;
    private Long customerId;
    private String customerGrade;
    private Double creditLimit;
    private Double creditBalance;
    private Double balancePayable;
    private List<String> methodOfPayment;
    private Double paymentAsCIA;
    private String bankName;
    private String accountNumber;
    private String creditCardType;
    private String creditCardNumber;
    private int defaults;
    private String creditProfileStatus;
    private CreditProfileState selectedCreditProfile;
    private List<CreditProfileState> selectedCreditProfiles;
    private CreditProfileState[] selectedCreditProfiless;
    private CreditProfileState selectedViewCreditProfile;
    private List<ClientState> custList;
    private String customerName;
    private String creditCheckStatus;
   
    /** Creates a new instance of CreditDisplayManagedBean */
    public CreditDisplayManagedBean() {
    }

    public void doDisplayCreditProfile(PhaseEvent event) {
        try {
            if (getCustomerId() == null) {
                setCustomerId((Long) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("customerId"));
            }
            if (getCreditProfileId() == null) {
                setCreditProfileId((Long) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("creditProfileId"));
            }
            if (getCustomerGrade() == null) {
                setCustomerGrade((String) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("customerGrade"));
            }
            if (getCreditLimit() == null) {
                setCreditLimit((Double) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("creditLimit"));
            }
            if (getCreditBalance() == null) {
                setCreditBalance((Double) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("creditBalance"));
            }
            if (getBalancePayable() == null) {
                setBalancePayable((Double) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("balancePayable"));
            }
            if (getMethodOfPayment() == null) {
                setMethodOfPayment((List<String>) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("methodOfPayment"));
            }
            if (getPaymentAsCIA() == null) {
                setPaymentAsCIA((Double) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("paymentAsCIA"));
            }
            if (getBankName() == null) {
                setBankName((String) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("bankName"));
            }
            if (getAccountNumber() == null) {
                setAccountNumber((String) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("accountNumber"));
            }
            if (getCreditCardType() == null) {
                setCreditCardType((String) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("creditCardType"));
            }
            if (getCreditCardNumber() == null) {
                setCreditCardNumber((String) FacesContext.getCurrentInstance().getExternalContext().getFlash().get("creditCardNumber"));
            }

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public Long getCreditProfileId() {
        return creditProfileId;
    }

    public void setCreditProfileId(Long creditProfileId) {
        this.creditProfileId = creditProfileId;
    }

    public Long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    public String getCustomerGrade() {
        return customerGrade;
    }

    public void setCustomerGrade(String customerGrade) {
        this.customerGrade = customerGrade;
    }

    public Double getCreditLimit() {
        return creditLimit;
    }

    public void setCreditLimit(Double creditLimit) {
        this.creditLimit = creditLimit;
    }

    public Double getCreditBalance() {
        return creditBalance;
    }

    public void setCreditBalance(Double creditBalance) {
        this.creditBalance = creditBalance;
    }

    public Double getBalancePayable() {
        return balancePayable;
    }

    public void setBalancePayable(Double balancePayable) {
        this.balancePayable = balancePayable;
    }

    public List<String> getMethodOfPayment() {
        return methodOfPayment;
    }

    public void setMethodOfPayment(List<String> methodOfPayment) {
        this.methodOfPayment = methodOfPayment;
    }

    public Double getPaymentAsCIA() {
        return paymentAsCIA;
    }

    public void setPaymentAsCIA(Double paymentAsCIA) {
        this.paymentAsCIA = paymentAsCIA;
    }

    public String getBankName() {
        return bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public String getCreditCardType() {
        return creditCardType;
    }

    public void setCreditCardType(String creditCardType) {
        this.creditCardType = creditCardType;
    }

    public String getCreditCardNumber() {
        return creditCardNumber;
    }

    public void setCreditCardNumber(String creditCardNumber) {
        this.creditCardNumber = creditCardNumber;
    }

    public int getDefaults() {
        return defaults;
    }

    public void setDefaults(int defaults) {
        this.defaults = defaults;
    }

    public String getCreditProfileStatus() {
        return creditProfileStatus;
    }

    public void setCreditProfileStatus(String creditProfileStatus) {
        this.creditProfileStatus = creditProfileStatus;
    }

    public CreditProfileState getSelectedCreditProfile() {
        return selectedCreditProfile;
    }

    public void setSelectedCreditProfile(CreditProfileState selectedCreditProfile) {
        this.selectedCreditProfile = selectedCreditProfile;
    }

    public List<CreditProfileState> getSelectedCreditProfiles() {
        return selectedCreditProfiles;
    }

    public void setSelectedCreditProfiles(List<CreditProfileState> selectedCreditProfiles) {
        this.selectedCreditProfiles = selectedCreditProfiles;
    }

    public CreditProfileState[] getSelectedCreditProfiless() {
        return selectedCreditProfiless;
    }

    public void setSelectedCreditProfiless(CreditProfileState[] selectedCreditProfiless) {
        this.selectedCreditProfiless = selectedCreditProfiless;
    }

    public CreditProfileState getSelectedViewCreditProfile() {
        return selectedViewCreditProfile;
    }

    public void setSelectedViewCreditProfile(CreditProfileState selectedViewCreditProfile) {
        this.selectedViewCreditProfile = selectedViewCreditProfile;
    }

    public List<ClientState> getCustList() {
        return custList;
    }

    public void setCustList(List<ClientState> custList) {
        this.custList = custList;
    }

    public String getCreditCheckStatus() {
        return creditCheckStatus;
    }

    public void setCreditCheckStatus(String creditCheckStatus) {
        this.creditCheckStatus = creditCheckStatus;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

}
